---@class Battle.BulletEffect :Battle.EffectBase
local BulletEffect = Battle.CreateClass("BulletEffect",Battle.EffectBase)
Battle.BulletEffect = BulletEffect

---@param bullet Battle.Bullet
function BulletEffect:BindBullet(bullet)
    self.bindId = bullet.id
    Battle.GlobalEventSystem.Register(Battle.Event.BulletPosChanged,self.BulletUpdatePos,self)
    Battle.GlobalEventSystem.Register(Battle.Event.BulletDie,self.BulletDie,self)
end
---@param args BulletArgs
function BulletEffect:BulletUpdatePos(args)
    if args.bullet.id ~= self.bindId then return end
    self:SetPosV(args.bullet.pos)
end
---@param args BulletArgs
function BulletEffect:BulletDie(args)
    if args.bullet.id ~= self.bindId then return end
    Battle.GlobalEventSystem.UnRegister(Battle.Event.BulletPosChanged,self.UpdatePos,self)
    Battle.GlobalEventSystem.UnRegister(Battle.Event.BulletDie,self.Die,self)
    self:Die()
end
